<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2018/4/16
  Time: 13:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String realPath = request.getServletContext().getRealPath("/");
  String newPath = realPath.replace('\\', '/');
%>

<div id="page-content">
  <div class="row">
    <div class="col-lg-12">
      <div class="panel">
        <div class="panel-heading">
          <h3 class="panel-title" style="display: inline">2018年换届${type=='before'?'前':'后'}书记情况明细表</h3>
        </div>

        <div class="panel-body">

          <form action="<%=path%>/com/screen/export" id="form_screen_input" class="form-horizontal" method="post">
            <input type="hidden" name="type" value="${type}" />
            <input type="hidden" name="title" value="2018年换届${type=='before'?'前':'后'}书记情况明细表" />
            <input name="filepath" id="filepath" type="hidden" value="" />
            <input name="fileFullName" id="fileFullName" type="hidden"/>

            <div class="form-group">
              <label class="col-md-2 control-label">所在街道</label>
              <div class="col-md-6">
                <select name="streetId" id="streetId" class="form-control" multiple="multiple">
                  <option value="">请选择</option>
                  <c:forEach items="${streetList}" var="item" varStatus="index">
                    <option value="${item.id}" >${item.name}</option>
                  </c:forEach>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">性别</label>
              <div class="col-md-6">
                <select name="gender" id="gender" class="form-control" style="width: 100%">
                  <option value="">请选择</option>
                  <option value="男">男</option>
                  <option value="女">女</option>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">出生日期</label>
              <div class="col-md-6">
                <div class="input-group">
                  <input type="text" class="form-control date" name="birthdayStart" placeholder="开始时间" aria-describedby="sizing-addon1">
                  <span class="input-group-addon" id="sizing-addon1">至</span>
                  <input type="text" class="form-control date" name="birthdayEnd" placeholder="结束时间" aria-describedby="sizing-addon1">
                </div>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">年龄</label>
              <div class="col-md-6">
                <div class="input-group">
                  <input type="number" class="form-control" name="ageStart" placeholder="最小年龄" aria-describedby="sizing-addon2">
                  <span class="input-group-addon" id="sizing-addon2">至</span>
                  <input type="number" class="form-control" name="ageEnd" placeholder="最大年龄" aria-describedby="sizing-addon2">
                </div>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">最高学历</label>
              <div class="col-md-6">
                <select name="eduId" id="eduId" class="form-control" multiple="multiple">
                  <option value="">请选择</option>
                  <c:forEach items="${eduList}" var="item" varStatus="index">
                    <option value="${item.id}" >${item.name}</option>
                  </c:forEach>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">入党时间</label>
              <div class="col-md-6">
                <div class="input-group">
                  <input type="text" class="form-control date" name="joinPartyStart" placeholder="开始时间" aria-describedby="sizing-addon3">
                  <span class="input-group-addon" id="sizing-addon3">至</span>
                  <input type="text" class="form-control date" name="joinPartyEnd" placeholder="结束时间" aria-describedby="sizing-addon3">
                </div>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">参加工作时间</label>
              <div class="col-md-6">
                <div class="input-group">
                  <input type="text" class="form-control date" name="joinWorkStart" placeholder="开始时间" aria-describedby="sizing-addon4">
                  <span class="input-group-addon" id="sizing-addon4">至</span>
                  <input type="text" class="form-control date" name="joinWorkEnd" placeholder="结束时间" aria-describedby="sizing-addon4">
                </div>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">人员性质</label>
              <div class="col-md-6">
                <select name="personNatureId" id="personNatureId" class="form-control" multiple="multiple">
                  <option value="">请选择</option>
                  <c:forEach items="${personNatureList}" var="item" varStatus="index">
                    <option value="${item.id}" >${item.name}</option>
                  </c:forEach>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">是否退休返聘</label>
              <div class="col-md-6">
                <select name="isFanPin" id="isFanPin" class="form-control" style="width: 100%">
                  <option value="">请选择</option>
                  <option value="1">是</option>
                  <option value="0">否</option>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">一肩挑情况</label>
              <div class="col-md-6">
                <select name="shoulder" id="shoulder" class="form-control" style="width: 100%">
                  <option value="">请选择</option>
                  <option value="1">是</option>
                  <option value="0">否</option>
                </select>
              </div>
            </div>

            <div class="form-group">
              <label class="col-md-2 control-label">民族</label>
              <div class="col-md-6">
                <select name="nationId" id="nationId" class="form-control">
                  <option value="">请选择</option>
                  <c:forEach items="${nationList}" var="item" varStatus="index">
                    <option value="${item.id}" >${item.name}</option>
                  </c:forEach>
                </select>
              </div>
            </div>

          </form>

        </div>

        <div class="panel-footer">
          <a class="btn btn-success" id="btn-export-screen" href="javascript:void(0);"><i class="fa fa-lg fa-download"></i> 导出 </a>
        </div>

      </div>
    </div>

  </div>
</div>

<script>

  // 日期选择
  $('.date').datepicker({
    format: 'yyyy-mm-dd',
    weekStart: 1,
    autoclose: true,
    todayBtn: 'linked',
    todayHighlight: true,
    language: 'zh-CN'
  });

  $("#nationId").select2({
    placeholder: "请选择民族",
    allowClear: true
  });

  $("#shoulder").select2({
    placeholder: "请选择一肩挑情况",
    allowClear: true
  });

  $("#isFanPin").select2({
    placeholder: "请选择是否是退休返聘",
    allowClear: true
  });

  $("#personNatureId").select2({
    placeholder: "请选择人员性质",
    tags:true,
    closeOnSelect: false
  });

  $("#eduId").select2({
    placeholder: "请选择最高学历",
    tags:true,
    closeOnSelect: false
  });

  $("#gender").select2({
    placeholder: "请选择性别",
    allowClear: true
  });

  $("#streetId").select2({
    placeholder: "请选择街道",
    tags:true,
    closeOnSelect: false
  });

  $("#btn-export-screen").click(function(){

    __form_save("form_screen_input","<%=path%>/com/screen/checkList", function(pdata){
      if(pdata.state==1){
        $('#filepath').val("<%=newPath%>/file/"+encodeURIComponent("screen.xls") );
        $('#fileFullName').val(encodeURIComponent("2018年换届${type=='before'?'前':'后'}书记情况明细表.xls"));
        $("#form_screen_input").submit();
      }
    });
  });

</script>